package com.hmall.search.listener;


import com.hmall.search.constants.MqConstants;
import com.hmall.search.service.HmallService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class HmallListener {
    @Autowired
    private HmallService hmallService;

    @RabbitListener(queues = MqConstants.HMALL_INSERT_QUEUE)
    public void listenHmallInsert(Long id){
        hmallService.insertById(id);
    }
    @RabbitListener(queues = MqConstants.HMALL_DELETE_QUEUE)
    public void listenHmallDelete(Long id){
        hmallService.deleteById(id);
    }
}
